// 函数定义: 可选参数
const func004: (a: number, b: number | undefined) => number = function (a, b) {
  return a
}
const func005: (a: number, b?: number) => number = (a, b?) => a
const func006 = function (a: number, b?: number): number {
  return a
}

console.log(func004(1, 2))
console.log(func005(5))

// 默认参数
const func007 = (a: number, b: number = 2): number => a + b
console.log(func007(2))

// 函数的剩余参数
function func008(...args: any[]) {
  console.log(args)
}
func008(1, 2, 3)